package com.itmg.analyze.jp.bean;

import com.itmg.analyze.jp.model.RakutenAuctionSearchParamModel;
import com.itmg.util.Constants;
import com.itmg.vo.SearchParameterVO;

/**
 *  获得检索的关键字,排序种类
 * @author Yunhong chen
 * */

public class RakutenAuctionParaBean {

	public RakutenAuctionParaBean() {
	}
	
	public static RakutenAuctionSearchParamModel getKakakuAuctionSearchParamModel(SearchParameterVO searchParameterVO) throws Exception
	{
		RakutenAuctionSearchParamModel rakutenSearchParamModel = new RakutenAuctionSearchParamModel();
		String keyword = searchParameterVO.getKeyword();
		rakutenSearchParamModel.setKeyword(keyword);
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_AFFLIATE_RATE_DOWN_TO_UP))
		{
			rakutenSearchParamModel.setSort("%2affiliateRate");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_AFFLIATE_RATE_UP_TO_DOWN))
		{
			rakutenSearchParamModel.setSort("-affiliateRate");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PRICE_DOWN_TO_UP))
		{
			//rakutenSearchParamModel.setSort("%2itemPrice");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PRICE_UP_TO_DOWN))
		{
			//rakutenSearchParamModel.setSort("-itemPrice");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_UPDATE_TIME_NEW_TO_OLD))
		{
			rakutenSearchParamModel.setSort("%2updateTimestamp");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_UPDATE_TIME_OLD_TO_NEW))
		{
			rakutenSearchParamModel.setSort("-updateTimestamp");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PV_RANK_DOWN_TO_UP))
		{
			rakutenSearchParamModel.setSort("%2reviewCount");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_PV_RANK_UP_TO_DOWN))
		{
			rakutenSearchParamModel.setSort("-reviewCount");
		}
		if(searchParameterVO.getSort() != null && searchParameterVO.getSort().equals(Constants.SORT_RELATIVE))
		{
//			rakutenSearchParamModel.setSort("standard");
		}
		return rakutenSearchParamModel;
	}
}
